home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_xemacs.idb / usr / freeware / lib / xemacs-20.4 / lisp / ilisp / ilisp-prc.el.z / ilisp-prc.el
Encoding:
Text File  |  1998-05-21  |  2.1 KB  |  76 lines

  1. ;;; -*- Mode: Emacs-Lisp -*-
  2.  
  3. ;;; ilisp-prc.el --
  4.  
  5. ;;; This file is part of ILISP.
  6. ;;; Version: 5.8
  7. ;;;
  8. ;;; Copyright (C) 1990, 1991, 1992, 1993 Chris McConnell
  9. ;;;               1993, 1994 Ivan Vasquez
  10. ;;;               1994, 1995, 1996 Marco Antoniotti and Rick Busdiecker
  11. ;;;               1996 Marco Antoniotti and Rick Campbell
  12. ;;;
  13. ;;; Other authors' names for which this Copyright notice also holds
  14. ;;; may appear later in this file.
  15. ;;;
  16. ;;; Send mail to 'ilisp-request@naggum.no' to be included in the
  17. ;;; ILISP mailing list. 'ilisp@naggum.no' is the general ILISP
  18. ;;; mailing list were bugs and improvements are discussed.
  19. ;;;
  20. ;;; ILISP is freely redistributable under the terms found in the file
  21. ;;; COPYING.
  22.  
  23.  
  24.  
  25. ;;;
  26. ;;; ILISP process handling
  27. ;;;
  28. ;;;
  29. (defun ilisp-process ()
  30.   "Return the current ILISP process."
  31.   (get-buffer-process (ilisp-buffer)))
  32.  
  33.  
  34. (defvar ilisp-buffer-function 'ilisp-recent-buffer
  35.   "A function of no arguments which returns the current ilisp buffer")
  36.  
  37.  
  38. ;;;%Buffer and process selection
  39. (defun ilisp-buffer ()
  40.   "Return the current ILISP buffer.  This is the buffer to whose process requests are sent."
  41.   (if (memq major-mode ilisp-modes)
  42.       (current-buffer)
  43.     (let ((buffer (funcall ilisp-buffer-function)))
  44.       (or buffer
  45.       (error "You must start an inferior LISP with run-ilisp.")))))
  46.  
  47.  
  48. (defun ilisp-recent-buffer ()
  49.   "Return the most-recently selected ilisp buffer." 
  50.   (if ilisp-buffer 
  51.       (or (get-buffer ilisp-buffer)
  52.       (get-buffer
  53.        (setq ilisp-buffers
  54.          (lisp-del (substring ilisp-buffer 1 
  55.                       (1- (length ilisp-buffer)))
  56.                ilisp-buffers 
  57.                (function (lambda (s1 s2)
  58.                        (string= s1 (car s2)))))
  59.          ilisp-buffer 
  60.          (format "*%s*" (car (car ilisp-buffers))))))))
  61.  
  62.  
  63. ;;;
  64. (defun select-ilisp ()
  65.   "Select the current ILISP buffer."
  66.   (interactive)
  67.   (let ((new (completing-read
  68.           (if ilisp-buffer
  69.           (format "Buffer [%s]: "
  70.               (substring ilisp-buffer 1
  71.                      (1- (length ilisp-buffer))))
  72.           "Buffer: ")
  73.           ilisp-buffers nil t)))
  74.     (if (not (zerop (length new)))
  75.     (setq ilisp-buffer (format "*%s*" new)))))
  76.